package SmartMeeting.observers;

import SmartMeeting.Entity.Meeting;
import SmartMeeting.decorators.ConcreteMeetingRecord;
import SmartMeeting.decorators.MeetingRecord;

public class LoggerObserver implements Observer {
    private MeetingRecord meetingRecord;
    private Meeting meeting;

    public LoggerObserver(MeetingRecord meetingRecord, Meeting meeting) {
        this.meetingRecord = meetingRecord;
        this.meeting = meeting;
    }

    @Override
    public void update(String message) {
        //记录日志
        if (meetingRecord != null) {
            meetingRecord.record(meeting);//打印会议ID
            System.out.println(meetingRecord.getContent());//打印会议内容
            //日志记录的装饰器实现的话，可以在MeetingSystem里实现

        } else {
            this.meetingRecord = new ConcreteMeetingRecord();
        }
    }
}
